﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LotteryVote.Utility;

namespace LotteryVote.Logic.Bet
{
    internal class FourDigitNumQuantityCounter : DigitNumQuantityCounter
    {
        protected override void CheckNumLength(string num)
        {
            if (num.Length != 4)
                throw new ArgumentException("num's length not equals 4");
        }

        protected override int GetHead()
        {
            throw new NotSupportedException();
        }
        protected override int GetHeadAndLast()
        {
            throw new NotSupportedException();
        }
        protected override int GetRoll()
        {
            return CompanySupportNumLen.Where(it => it.Length.Length >= 4).Sum(it => it.Count);
        }

        public override string GetRealyBetNum(string num)
        {
            if (num.Length > 4)
                return num.Substring(num.Length - 4);
            return num;
        }
    }
}
